<%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<!DOCTYPE html>
<html>
 <head>
  <title>工地</title>
  <t:base type="jquery,easyui,tools,DatePicker"></t:base>
  <link rel="stylesheet" href="plug-in/uploadify/css/uploadify.css" type="text/css" />
  <script type="text/javascript" src="plug-in/uploadify/jquery.uploadify-3.1.js"></script>
  <script type="text/javascript">
  //编写自定义JS代码
  </script>
 </head>
 <body>
  <t:formvalid formid="formobj" dialog="true" usePlugin="password" layout="table" action="tKpGongdiController.do?doAdd" callback="jeecgFormFileCallBack@Override">
					<input id="id" name="id" type="hidden" value="${tKpGongdiPage.id }"/>
		<table style="width: 720px;" cellpadding="0" cellspacing="1" class="formtable">
				<tr>
					<%--<td align="right">--%>
						<%--<label class="Validform_label">--%>
							<%--工地编码:--%>
						<%--</label>--%>
					<%--</td>--%>
					<%--<td class="value">--%>
					     	 <%--<input id="gdCode" name="gdCode" type="text" style="width: 150px" class="inputxt" 		validType="t_kp_gongdi,gd_code,id" datatype="*" ignore="ignore" />--%>
							<%--<span class="Validform_checktip"></span>--%>
							<%--<label class="Validform_label" style="display: none;">工地编码</label>--%>
						<%--</td>--%>
					<td align="right">
						<label class="Validform_label">
							承建单位:
						</label>
					</td>
					<td class="value">
					     	 <input id="gdName" name="gdName" type="text" style="width: 250px" class="inputxt"  ignore="ignore" />
							<span class="Validform_checktip"></span>
							<label class="Validform_label" style="display: none;">承建单位</label>
						</td>

					<td align="right">
						<label class="Validform_label">
							项目名称:
						</label>
					</td>
					<td class="value">
					     	 <input id="gdDizhi" name="gdDizhi" type="text" style="width: 150px" class="inputxt"  ignore="ignore" />
							<span class="Validform_checktip"></span>
							<label class="Validform_label" style="display: none;">项目名称</label>
						</td>

					</tr>
				<tr>
					<td align="right">
						<label class="Validform_label">
							税号:
						</label>
					</td>
					<td class="value">
					     	 <input id="gdShuihao" name="gdShuihao" type="text" style="width: 150px" class="inputxt"  ignore="ignore" />
							<span class="Validform_checktip"></span>
							<label class="Validform_label" style="display: none;">税号</label>
						</td>
					<td align="right">
						<label class="Validform_label">
							开户行:
						</label>
					</td>
					<td class="value">
					     	 <input id="gdKaihuhang" name="gdKaihuhang" type="text" style="width: 150px" class="inputxt"  ignore="ignore" />
							<span class="Validform_checktip"></span>
							<label class="Validform_label" style="display: none;">开户行</label>
						</td>
					</tr>
				<tr>
					<td align="right">
						<label class="Validform_label">
							账号:
						</label>
					</td>
					<td class="value">
					     	 <input id="gdZhanghao" name="gdZhanghao" type="text" style="width: 150px" class="inputxt"  ignore="ignore" />
							<span class="Validform_checktip"></span>
							<label class="Validform_label" style="display: none;">账号</label>
						</td>
					<td align="right">
						<label class="Validform_label">
							联系人:
						</label>
					</td>
					<td class="value">
						<input id="gdLianxiren" name="gdLianxiren" type="text" style="width: 150px" class="inputxt"  ignore="ignore" />
						<span class="Validform_checktip"></span>
						<label class="Validform_label" style="display: none;">联系人</label>
					</td>
					<%--<td align="right">--%>
						<%--<label class="Validform_label">--%>
							<%--附件:--%>
						<%--</label>--%>
					<%--</td>--%>
					<%--<td class="value">--%>
								<%--<table></table>--%>
								<%--<div class="form jeecgDetail"> --%>
									<%--<script type="text/javascript">--%>
										<%--var serverMsg="";--%>
										<%--$(function(){--%>
											<%--$('#gdFujian').uploadify({--%>
												<%--buttonText:'添加文件',--%>
												<%--auto:false,--%>
												<%--progressData:'speed',--%>
												<%--multi:true,--%>
												<%--height:25,--%>
												<%--overrideEvents:['onDialogClose'],--%>
												<%--fileTypeDesc:'文件格式:',--%>
												<%--queueID:'filediv_gdFujian',--%>
												<%--fileSizeLimit:'15MB',--%>
												<%--swf:'plug-in/uploadify/uploadify.swf',	--%>
												<%--uploader:'cgUploadController.do?saveFiles&jsessionid='+$("#sessionUID").val()+'',--%>
												<%--onUploadStart : function(file) { --%>
													<%--var cgFormId=$("input[name='id']").val();--%>
													<%--$('#gdFujian').uploadify("settings", "formData", {--%>
														<%--'cgFormId':cgFormId,--%>
														<%--'cgFormName':'t_kp_gongdi',--%>
														<%--'cgFormField':'GD_FUJIAN'--%>
													<%--});--%>
												<%--} ,--%>
												<%--onQueueComplete : function(queueData) {--%>
													 <%--var win = frameElement.api.opener;--%>
													 <%--win.reloadTable();--%>
													 <%--win.tip(serverMsg);--%>
													 <%--frameElement.api.close();--%>
												<%--},--%>
												<%--onUploadSuccess : function(file, data, response) {--%>
													<%--var d=$.parseJSON(data);--%>
													<%--if(d.success){--%>
														<%--var win = frameElement.api.opener;--%>
														<%--serverMsg = d.msg;--%>
													<%--}--%>
												<%--},--%>
												<%--onFallback: function() {--%>
								                    <%--tip("您未安装FLASH控件，无法上传图片！请安装FLASH控件后再试")--%>
								                <%--},--%>
								                <%--onSelectError: function(file, errorCode, errorMsg) {--%>
								                    <%--switch (errorCode) {--%>
								                    <%--case - 100 : tip("上传的文件数量已经超出系统限制的" + $('#file').uploadify('settings', 'queueSizeLimit') + "个文件！");--%>
								                        <%--break;--%>
								                    <%--case - 110 : tip("文件 [" + file.name + "] 大小超出系统限制的" + $('#file').uploadify('settings', 'fileSizeLimit') + "大小！");--%>
								                        <%--break;--%>
								                    <%--case - 120 : tip("文件 [" + file.name + "] 大小异常！");--%>
								                        <%--break;--%>
								                    <%--case - 130 : tip("文件 [" + file.name + "] 类型不正确！");--%>
								                        <%--break;--%>
								                    <%--}--%>
								                <%--},--%>
								                <%--onUploadProgress: function(file, bytesUploaded, bytesTotal, totalBytesUploaded, totalBytesTotal) {}--%>
											<%--});--%>
										<%--});--%>
									<%--</script>--%>
									<%--<span id="file_uploadspan"><input type="file" name="gdFujian" id="gdFujian" /></span> --%>
								<%--</div> --%>
								<%--<div class="form" id="filediv_gdFujian"></div>--%>
							<%--<span class="Validform_checktip"></span>--%>
							<%--<label class="Validform_label" style="display: none;">附件</label>--%>
						<%--</td>--%>
					</tr>
				<tr>
					<td align="right">
						<label class="Validform_label">
							备注:
						</label>
					</td>
					<td class="value">
					     	 <input id="gdRemark" name="gdRemark" type="text" style="width: 150px" class="inputxt"  ignore="ignore" />
							<span class="Validform_checktip"></span>
							<label class="Validform_label" style="display: none;">备注</label>
						</td>
					<td align="right">
						<label class="Validform_label">
							客户名称:
						</label>
					</td>
					<td class="value">
						<t:dictSelect field="by1"  dictTable="t_kp_cus"   dictField="cus_code" dictText="cus_name" title="客户名称"></t:dictSelect>

						<%--<input id="by1" name="by1" type="text" style="width: 150px" class="inputxt"  ignore="ignore" />--%>
							<span class="Validform_checktip"></span>
							<label class="Validform_label" style="display: none;">客户名称</label>
						</td>
					</tr>
				<tr>
					<td align="right">
						<label class="Validform_label">
							代码:
						</label>
					</td>
					<td class="value">
					     	 <input id="by2" name="by2" type="text" style="width: 150px" class="inputxt"  ignore="ignore" />
							<span class="Validform_checktip"></span>
							<label class="Validform_label" style="display: none;">代码</label>
						</td>
					<%--<td align="right">--%>
						<%--<label class="Validform_label">--%>
							<%--备用3:--%>
						<%--</label>--%>
					<%--</td>--%>
					<%--<td class="value">--%>
					     	 <%--<input id="by3" name="by3" type="text" style="width: 150px" class="inputxt"  ignore="ignore" />--%>
							<%--<span class="Validform_checktip"></span>--%>
							<%--<label class="Validform_label" style="display: none;">备用3</label>--%>
						<%--</td>--%>
					</tr>
				<%--<tr>--%>
					<%--<td align="right">--%>
						<%--<label class="Validform_label">--%>
							<%--备用4:--%>
						<%--</label>--%>
					<%--</td>--%>
					<%--<td class="value">--%>
					     	 <%--<input id="by4" name="by4" type="text" style="width: 150px" class="inputxt"  ignore="ignore" />--%>
							<%--<span class="Validform_checktip"></span>--%>
							<%--<label class="Validform_label" style="display: none;">备用4</label>--%>
						<%--</td>--%>
					<%--<td align="right">--%>
						<%--<label class="Validform_label">--%>
							<%--备用5:--%>
						<%--</label>--%>
					<%--</td>--%>
					<%--<td class="value">--%>
					     	 <%--<input id="by5" name="by5" type="text" style="width: 150px" class="inputxt"  ignore="ignore" />--%>
							<%--<span class="Validform_checktip"></span>--%>
							<%--<label class="Validform_label" style="display: none;">备用5</label>--%>
						<%--</td>--%>
					<%--</tr>--%>
				<%----%>
				
			</table>
		</t:formvalid>
 </body>
  <script src = "webpage/com/yserp/kpmd/tKpGongdi.js"></script>		
	  	<script type="text/javascript">
	  		function jeecgFormFileCallBack(data){
	  			if (data.success == true) {
					uploadFile(data);
				} else {
					if (data.responseText == '' || data.responseText == undefined) {
						$.messager.alert('错误', data.msg);
						$.Hidemsg();
					} else {
						try {
							var emsg = data.responseText.substring(data.responseText.indexOf('错误描述'), data.responseText.indexOf('错误信息'));
							$.messager.alert('错误', emsg);
							$.Hidemsg();
						} catch(ex) {
							$.messager.alert('错误', data.responseText + '');
						}
					}
					return false;
				}
				if (!neibuClickFlag) {
					var win = frameElement.api.opener;
					win.reloadTable();
				}
	  		}
	  		function upload() {
					$('#gdFujian').uploadify('upload', '*');	
			}
			
			var neibuClickFlag = false;
			function neibuClick() {
				neibuClickFlag = true; 
				$('#btn_sub').trigger('click');
			}
			function cancel() {
					$('#gdFujian').uploadify('cancel', '*');
			}
			function uploadFile(data){
				if(!$("input[name='id']").val()){
					if(data.obj!=null && data.obj!='undefined'){
						$("input[name='id']").val(data.obj.id);
					}
				}
				if($(".uploadify-queue-item").length>0){
					upload();
				}else{
					if (neibuClickFlag){
						alert(data.msg);
						neibuClickFlag = false;
					}else {
						var win = frameElement.api.opener;
						win.reloadTable();
						win.tip(data.msg);
						frameElement.api.close();
					}
				}
			}
	  	</script>
